<?php

class openapi_errorcode {

    static public function get($code) {
        $errorInfos = array(
            // 错误码
            'e000001' => array(
                'code' => 'e000001',
                'msg' => 'system params lost or error'
            ),
            'e000002' => array(
                'code' => 'e000002',
                'msg' => 'sign error'
            ),
            'e000003' => array(
                'code' => 'e000003',
                'msg' => 'class or method not exist'
            ),
            'e000004' => array(
                'code' => 'e000004',
                'msg' => 'no permissions to access'
            ),
            'e000005' => array(
                'code' => 'e000005',
                'msg' => 'init interface fail'
            ),
            'e000006' => array(
                'code' => 'e000006',
                'msg' => 'application params error'
            ),
            'e000007' => array(
                'code' => 'e000007',
                'msg' => 'init template fail'
            )
        );
        $errorAppInfos = array(
            'a000001' => array(
                'code' => 'a000001',
                'msg' => '退货单号对应订单不存在'
            ),
            'a000002' => array(
                'code' => 'a000002',
                'msg' => '订单信息已存在'
            ),
            'a000003' => array(
                'code' => 'a000003',
                'msg' => '换货单对应订单号不存在'
            ),
            'a000004' => array(
                'code' => 'a000004',
                'msg' => '订单信息不存在'
            ),
            'a000005' => array(
                'code' => 'a000005',
                'msg' => '换货单号已存在'
            ),
            'a000006' => array(
                'code' => 'a000006',
                'msg' => '暂不发货恢复状态非法'
            ),
            'a000007' => array(
                'code' => 'a000007',
                'msg' => '订单已是发货状态无法修改'
            ),
            'a000008' => array(
                'code' => 'a000008',
                'msg' => '暂停发货状态非法'
            ),
            'a000009' => array(
                'code' => 'a000009',
                'msg' => '订单已暂停发货'
            ),
            'a000010' => array(
                'code' => 'a000010',
                'msg' => '暂停发货失败'
            ),
            'a000011' => array(
                'code' => 'a000010',
                'msg' => '订单已是发货状态无法修改'
            ),
            'a000012' => array(
                'code' => 'a000010',
                'msg' => '订单添加失败'
            ),
            'a000013' => array(
                'code' => 'a000010',
                'msg' => '地区信息错误'
            ),
            'a000014' => array(
                'code' => 'a000010',
                'msg' => '会员编号格式错误'
            ),
            'a000015' => array(
                'code' => 'a000010',
                'msg' => '卖家网体信息不存在'
            )
        );
        if (isset($errorInfos[$code])) {
            return $errorInfos[$code] ? $errorInfos[$code] : array(
                'code' => $code,
                'msg' => ''
            );
        } elseif (isset($errorAppInfos[$code])) {
            $res = $errorAppInfos[$code];
            $res['code'] = 'e000006';
            return $res;
        }
    }
}